home *** CD-ROM | disk | FTP | other *** search
-
- --------------------------------------------------------------------------
- oopbase.doc
-
- OOP Database routines
-
- Interface Documentation
-
- Silico-Magnetic Intelligence
- 24 Jean Lane
- Chestnut Ridge, NY 10952
- 914 426-2610 FAX: 914 426-3152
-
-
-
- --------------------------------------------------------------------------
-
- Summary
-
- The oopbase module is an object-oriented database library.
- A record in the database consists of a key and a data part.
- The two parts are separated by an internal character in the database.
- The records are organized into a multi-level tree following ascii
- sorting sequence. The combined size of key and data cannot exceed
- Record_max which is defined in oopbase.d.
-
-
- List of Functions
-
- db_start - activate module
-
- db_end - deactivate module
-
- db_open - activate database object
-
- db_close - destroy database object
-
- db_create - create database
-
- db_insert - add a record
-
- db_read_key - read database by key
-
- db_search - search database
-
- db_go_to_first - set database pointer to beginning
-
- db_go_to_last - set database pointer to end
-
- db_read_next - read next record
-
- db_read_previous - read_previous record
-
-
- Notes
-
-
-
- --------------------------------------------------------------------------
- db_open
- --------------------------------------------------------------------------
-
- Function Creates a database object.
-
- Syntax int db_open( char * file_name )
-
- Arguments file_name - disk name of database
-
- Remarks If creation succesful, memory is allocated for object,
- file is opened, and a handle is returned.
-
-
- Return value >=0 ok, handle is returned
- Eof failed to create object
- Limitations
-
- See also db_close, db_create
-
- Example if ( ( phone_base = db_open( "phones.db") ) == Eof )
- ret = false;
-
-
- --------------------------------------------------------------------------
- db_close
- --------------------------------------------------------------------------
-
- Function Destroys object.
-
- Syntax void db_close ( int handle)
-
- Arguments handle - handle of object to be destroyed
-
-
-
- Remarks Closes file, deallocates memory, releases handle.
-
- Limitations
-
- See also db_open
-
- Example db_close( phone_base );
-
-
-
-
- --------------------------------------------------------------------------
- db_start
- --------------------------------------------------------------------------
-
- Function Allocates memory for module structure.
-
- Syntax int db_start()
-
- Arguments
-
-
-
- Remarks Should be called at the beginning of the program.
-
-
-
- Return value true: allocation is ok, module can be used
- false: failure to allocate, module is not active
-
- Limitations
-
- See also db_end
-
- Example if ( not db_start() )
- ret = Eof;
-
-
- --------------------------------------------------------------------------
- db_end
- --------------------------------------------------------------------------
-
- Function Deallocates memory of module structure.
-
- Syntax void db_end()
-
- Arguments
-
-
- Remarks Should be called at the end of the program.
-
-
- Return value
-
- Limitations
-
- See also db_start
-
- Example db_end();
-
-
-
- --------------------------------------------------------------------------
- db_create
- --------------------------------------------------------------------------
-
- Function Create database
-
- Syntax int db_create( char *file_name, char *database_title)
-
-
- Arguments file_name - database diskfile name
- database_title - diskfile header information
-
-
- Remarks Creates a new database.
- Use it only once!
- Open must be used to access the created database.
-
-
- Return value true - db created ok
- false - io failure
-
- Limitations
-
- See also db_open
-
- Example db_create( "phones.db", "Customer telephone numbers");
-
-
-
- --------------------------------------------------------------------------
- db_insert
- --------------------------------------------------------------------------
-
- Function Insert record
-
- Syntax int db_insert( int handle, char *key, char *data)
-
-
- Arguments key - key string
- data - data string
-
-
- Remarks Inserts new record into database.
- Combined size cannot exceed Record_max default.
-
-
- Return value Eof - io failure
- false - duplicate
- true - inserted ok
- Limitations
-
- See also
-
- Example db_insert( phone_base, "Jane Gizzy", "212 543-2344");
-
-
- --------------------------------------------------------------------------
- db_update
- --------------------------------------------------------------------------
-
- Function Update record
-
- Syntax int db_update( int handle, char *key, char *new_data)
-
-
- Arguments key of current record
- new_data to replace current data
-
-
-
- Remarks Updates record with key by replacing current data with
- new data.
- If record does not exist, it is inserted.
-
-
-
- Return value true - ok
- false - io failure
-
- Limitations
-
- See also db_insert
-
- Example db_update( phone_base, "Jane Gizzy", "202 345-7777");
-
-
-
- --------------------------------------------------------------------------
- db_delete
- --------------------------------------------------------------------------
-
- Function Delete record
-
- Syntax int db_delete( int handle, char *key)
-
-
- Arguments key - key of record to be deleted
-
-
- Remarks Deletes record from database.
-
-
- Return value Eof - io failure
- false - not found
- true - record deleted
- Limitations
-
- See also db_search
-
- Example db_delete( phone_base, "Jane Gizzy");
-
-
-
- --------------------------------------------------------------------------
- db_go_to_first
- --------------------------------------------------------------------------
-
- Function Position to head of database
-
- Syntax void db_go_to_first( int handle)
-
-
- Remarks Positions to first record in ascii ascending sort order.
-
-
- Limitations
-
- See also db_read_next
-
- Example db_go_to_first( phone_base);
-
-
-
- --------------------------------------------------------------------------
- db_go_to_last
- --------------------------------------------------------------------------
-
- Function Position to end of database
-
- Syntax void db_go_to_last( int handle)
-
-
- Remarks Positions to last record in ascii ascending order.
-
-
- Limitations
-
- See also db_read_previous
-
- Example db_go_to_last (phone_base);
-
-
-
- --------------------------------------------------------------------------
- db_read_next
- --------------------------------------------------------------------------
-
- Function Read next record
-
- Syntax int db_read_next( int handle, char *key, char *data)
-
-
- Arguments key - key of next record
- data - data of next record
-
-
- Remarks Reads next record in database.
- Returns record key and data.
-
-
-
-
- Return value Eof - if at end of database
- true - otherwise
-
- Limitations
-
- See also db_go_to_first
-
- Example while ( db_read_next(phone_base, name, phone) EQ true)
- printf("\n %s \t-- %s", name, phone);
-
-
-
- --------------------------------------------------------------------------
- db_read_previous
- --------------------------------------------------------------------------
-
- Function Read previous record
-
- Syntax int db_read_previous( int handle, char *key, char *data)
-
-
- Arguments key - key of next record
- data - data of next record
-
-
- Remarks Reads previous record in database.
- Returns record key and data.
-
-
- Return value Eof - if at head of database
- true - otherwise
-
- Limitations
-
- See also db_go_to_last
-
- Example while ( db_read_previous(phone_base, name, phone) EQ true)
- printf("\n %s \t-- %s", name, phone);
-
-
-
- --------------------------------------------------------------------------
- db_read_key
- --------------------------------------------------------------------------
-
- Function Read key
-
- Syntax int db_read_key( int handle, char *key, char *data)
-
-
- Arguments key - key of record to be located
- data - data of located record
-
-
-
- Remarks Locates record with key as identifier.
- Returns record data.
-
-
-
-
- Return value true - ok
- false - not found
-
- Limitations
-
- See also db_search
-
- Example db_read_key( phone_base, "Jane Gizzy", phone);
-
-
-
- --------------------------------------------------------------------------
- db_search_key
- --------------------------------------------------------------------------
-
- Function Search key
-
- Syntax int db_search_key( int handle, char *key)
-
-
- Arguments key - record sought
-
- Remarks Searches database for record with key.
-
-
- Return value true - record found
- false - not found
-
- Limitations
-
- See also db_read_next, db_read_previous
-
- Example if ( db_search( phone_base, "Jane Gizzy") EQ true)
- begin_if ....... end_if
-
-
- End of oopbase Interface Documentation
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- Public (software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. PsL cannot debug pro-
- programs over the telephone, though we can answer questions.
-
- Disks in the PsL are updated monthly, so if you did not get
- this disk directly from the PsL, you should be aware that the
- files in this set may no longer be the current versions. Also,
- if you got this disk from another vendor and are having prob-
- lems, be aware that some files may have become corrupted or
- lost by that vendor. Get a current, working disk from PsL.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 3,000+ disks in the library, call or write
-
- Public (software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
-
- Orders only:
- 1-800-2424-PSL
- MC/Visa/AmEx/Discover
-
- Outside of U.S. or in Texas
- or for general information,
- Call 1-713-524-6394
-
- PsL also has an outstanding
- catalog for the Macintosh.
-
-